<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="Fname">
        <input type="text" v-model="Lname"><br>
        
        <button >{{yin}}</button>
        {{add}}
    </div>
    <script>
        const vm = new Vue({
            el:"#app",
            data(){
                return {
                    Fname:'',
                    Lname:'',
                    yin:''
                }
            },
                
            computed:{
                //只有当前属性发生变化 才会触发这个函数 不会产生其他冗余的计算
                add() {
                    console.log('我执行了一次');
                    return this.Fname.toUpperCase() + "-" + this.Lname.toUpperCase();
                },
            }
        })
    </script>
</body>
</html>